//
//  MySelfCell.m
//  EducationAdminClient
//
//  Created by 孙添凤 on 16/9/19.
//  Copyright © 2016年 周佳兴. All rights reserved.
//

#import "MySelfCell.h"
#import "Masonry.h"
#import "UIColor+CL.h"
@implementation MySelfCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}


-(instancetype)initWithReuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:UITableViewCellStyleDefault reuseIdentifier:reuseIdentifier];
    //    self.selectionStyle = UITableViewCellSelectionStyleNone;
    
    if (self) {
        UIView *view = [self createUI];
        [self.contentView addSubview:view];
        [view mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.contentView.mas_left);
            make.right.equalTo(self.contentView.mas_right);
            make.height.equalTo(self.contentView.mas_height);
            make.bottom.equalTo(self.contentView.mas_bottom);
        }];

        
    }
    return self;
}

-(UIView *)createUI{
    UIView *baseView = [[UIView alloc]init];
    baseView.backgroundColor =[UIColor whiteColor];
    
    _img =[[UIImageView alloc]init];
    [baseView addSubview:_img];
    [_img sizeToFit];
    [_img mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(baseView.mas_left).offset(15);
        make.centerY.equalTo(baseView.mas_centerY);
    }];
    
    _label =[[UILabel alloc]init];
    [baseView addSubview:_label];
    [_label sizeToFit];
    [_label mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(_img.mas_right).offset(12);
        make.centerY.equalTo(baseView.mas_centerY);
    }];
    _label.text=@"ddd";
    _label.font =[UIFont systemFontOfSize:17];
    
    _arrow =[[UIImageView alloc]init];
    [baseView addSubview:_arrow];
    [_arrow sizeToFit];
    [_arrow mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(baseView.mas_right).offset(-15);
        make.centerY.equalTo(baseView.mas_centerY);
    }];
    _arrow.image =[UIImage imageNamed:@"often_into"];
    _versionLabel = [[UILabel alloc] init];
    [baseView addSubview:_versionLabel];
    [_versionLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(baseView.mas_right).offset(-15);
        make.centerY.equalTo(baseView.mas_centerY);
    }];
    _versionLabel.hidden = YES;
    NSDictionary *infoDictionary = [[NSBundle mainBundle] infoDictionary];
    NSString *app_Version = [infoDictionary objectForKey:@"CFBundleShortVersionString"];
    _versionLabel.text = app_Version;
    _versionLabel.textColor = [UIColor colorWithHex:0x858585];
    _versionLabel.font = [UIFont systemFontOfSize:28/2];
    UIView *lineview =[[UIView alloc]init];
    [baseView addSubview:lineview];
    [lineview mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(baseView.mas_left).offset(15);
        make.right.equalTo(baseView.mas_right);
        make.bottom.equalTo(baseView.mas_bottom);
        make.height.equalTo(@(1));
    }];
    lineview.backgroundColor =[UIColor colorWithHex:0xe3e3e3];
    
    return baseView;
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
